package com.idanchuang.component.core.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yjy
 * Created at 2022/2/25 2:46 下午
 */
public class PtsUtil {

    /**
     * 解析header中的Pts-Si
     * @param ptsSi header值
     * @return map集合
     */
    public static Map<String, String> parsePtsSi(String ptsSi) {
        if (ptsSi == null || ptsSi.isEmpty()) {
            return null;
        }
        Map<String, String> map = new HashMap<>();
        String[] sis = ptsSi.split(",");
        for (String si : sis) {
            if (si == null || si.isEmpty()) {
                continue;
            }
            String[] tsi = si.split(":", 2);
            map.put(tsi[0], tsi[1]);
        }
        return map;
    }

}
